﻿package plugin.roleN.controller
{
    import com.core.*;
    import com.sh.game.display.*;
    import com.sh.game.global.*;
    import flash.events.*;
    import morn.core.handlers.*;
    import uiresource.roleui.*;

    public class FeiShenItemCtrl extends FeiShenItemUI
    {
        private var _isMC:Boolean;
        private var _mc:XMLMovieClip;
        private var _data:Object;
        public static const flyhuo:Class = FeiShenItemCtrl_flyhuo;

        public function FeiShenItemCtrl()
        {
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            fly.addEventListener(MouseEvent.ROLL_OUT, this.rollout);
            fly.addEventListener(MouseEvent.ROLL_OVER, this.rollover);
            return;
        }// end function

        protected function rollover(event:MouseEvent) : void
        {
            if (this._data)
            {
                ModelProxy.change("tips", "normal", this._data);
            }
            return;
        }// end function

        protected function rollout(event:MouseEvent) : void
        {
            ModelProxy.change("tips", "state", "close");
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            this._data = param1;
            return;
        }// end function

        private function completeFunc1(param1:Object) : void
        {
            var _loc_2:XML = null;
            if (this._isMC)
            {
                _loc_2 = new XML(new flyhuo());
                this._mc = new XMLMovieClip("png.flyhuo", _loc_2);
                this._mc.mouseChildren = false;
                this._mc.mouseEnabled = false;
                this._mc.x = -2;
                this._mc.y = -68;
                this.addChild(this._mc);
            }
            return;
        }// end function

        public function set isMc(param1:Boolean) : void
        {
            if (this._isMC != param1)
            {
                this._isMC = param1;
                if (param1)
                {
                    suo.url = "cs2_zhuansheng/yuanicon.png";
                    App.mloader3.loadSWF(Config.getUrl("assets/images/mainui/flyhuo.swf"), 1, new Handler(this.completeFunc1));
                }
                else
                {
                    suo.url = "cs2_zhuansheng/yuanicon1.png";
                    this.clearMC();
                }
            }
            return;
        }// end function

        public function clearMC() : void
        {
            if (this._mc)
            {
                this._mc.dispose();
                if (this._mc.parent)
                {
                    this._mc.parent.removeChild(this._mc);
                }
                this._mc = null;
            }
            this._isMC = false;
            return;
        }// end function

    }
}
